.PYONY: all, init, sync, clean, install

_prefix=dist
_service=${_prefix}/service
_tools=${_prefix}/tools
_doc=${_prefix}/doc
_api=${_prefix}/api

all:
	make all -C userInfo
#	make all -C CollegeStruct
#	make all -C DisciplineStruct
	make all -C ClassStruct
	make all -C Course
	make all -C chapter
	make all -C bank
	make all -C question
	make all -C resource
	make all -C cli
	make build -C rfc

init:
	git submodule update --init

sync:
	make sync -C userInfo
# 	make sync -C CollegeStruct
# 	make sync -C DisciplineStruct
	make sync -C ClassStruct
	make sync -C Course
	make sync -C chapter
# 	make sync -C bank
	make sync -C question
	make sync -C resource
	make sync -C cli
	make sync -C core

clean:
	@rm -vrf dist
	make clean -C userInfo
# 	make clean -C CollegeStruct
# 	make clean -C DisciplineStruct
	make clean -C ClassStruct
	make clean -C Course
	make clean -C chapter
# 	make clean -C bank
	make clean -C question
	make clean -C resource
	make clean -C cli
	make clean -C core
	make clean -C rfc

install:
	mkdir -p ${_prefix} ${_service} ${_tools} ${_doc} ${_api}
	mkdir -p ${_prefix}/tools
	mkdir -p ${_prefix}/doc
	@cp -fv userInfo/service-user ${_service}
	@#cp -fv CollegeStruct/service-CollegeStruct ${_service}
	@#cp -fv DisciplineStruct/service-DisciplineStruct ${_service}
	@cp -fv ClassStruct/service-class ${_service}
	@cp -fv Course/service-course ${_service}
	@cp -fv chapter/service-chapter ${_service}
	@#cp -fv bank/service-bank ${_service}
	@cp -fv question/service-question ${_service}
	@cp -fv resource/service-resource ${_service}
	@cp -fv cli/dist/* ${_tools}
# 	@cp -rv rfc/dist/* ${_doc}
	@cp -rv swaggerUI/* ${_api}
	@cp -fv core/protobufs/v1/pb/*.json ${_api}
	@cp -fv resource/resource_service.swagger.json ${_api}
